package com.sdygmedia.action;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.sdygmedia.service.ArticleService;
import com.sdygmedia.service.CategoryService;
import com.sdygmedia.service.PageService;

@Controller
public class IndexAction extends ActionSupport {

	@Resource
	private CategoryService categoryService;
	@Resource
	private ArticleService articleService;
	@Resource
	private PageService pageService;

	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub

		List categoryList = categoryService.findAll();
		List pageList = pageService.findAll();
		List imgList = articleService.getIndexImage();
		
		
		ActionContext.getContext().put("categoryList", categoryList);
		ActionContext.getContext().put("pageList", pageList);
		ActionContext.getContext().put("imgList", imgList);
		
		return super.execute();
	}


	
	//--------------------------------------------------------
	public CategoryService getCategoryService() {
		return categoryService;
	}

	public void setCategoryService(CategoryService categoryService) {
		this.categoryService = categoryService;
	}

	public ArticleService getArticleService() {
		return articleService;
	}

	public void setArticleService(ArticleService articleService) {
		this.articleService = articleService;
	}

	public PageService getPageService() {
		return pageService;
	}

	public void setPageService(PageService pageService) {
		this.pageService = pageService;
	}

}
